package com.kefu.robot.vo;

import org.apache.commons.lang3.StringUtils;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.kefu.common.context.KefuContext;
import com.kefu.common.vo.AbstractSearchVo;
import com.kefu.robot.model.RobotAidataRecording;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.ToString;

/**
 * @author xiaoyu
 * @date 2023/11/17
 */
@Data
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
@ApiModel(description = "AI大模型记录")
public class RobotAidataRecordingSearchVo extends AbstractSearchVo {

    @ApiModelProperty(value = "问题")
    private String question;
    @ApiModelProperty(value = "大模型回答")
    private String answer;
    @ApiModelProperty(value = "会话id")
    private String session;
    @ApiModelProperty(value = "创建时间开始")
    private Long createTimeStart;
    @ApiModelProperty(value = "创建时间结束")
    private Long createTimeEnd;
    @ApiModelProperty(value = "创建人")
    private String createUser;
    @ApiModelProperty(value = "更新时间开始")
    private Long updateTimeStart;
    @ApiModelProperty(value = "更新时间结束")
    private Long updateTimeEnd;
    @ApiModelProperty(value = "更新人")
    private String updateUser;

	 @Override
    public  LambdaQueryWrapper<RobotAidataRecording> lambdaQuery(){
    	LambdaQueryWrapper<RobotAidataRecording> wrapper=Wrappers.<RobotAidataRecording>lambdaQuery();
	    wrapper.eq(StringUtils.isNotBlank(question), RobotAidataRecording::getQuestion, question);
	    wrapper.eq(StringUtils.isNotBlank(answer), RobotAidataRecording::getAnswer, answer);
	    wrapper.eq(StringUtils.isNotBlank(session), RobotAidataRecording::getSession, session);
		wrapper.ge(createTimeStart!=null, RobotAidataRecording::getCreateTime, createTimeStart);
		wrapper.le(createTimeEnd!=null, RobotAidataRecording::getCreateTime, createTimeEnd);
	    wrapper.eq(StringUtils.isNotBlank(createUser), RobotAidataRecording::getCreateUser, createUser);
		wrapper.ge(updateTimeStart!=null, RobotAidataRecording::getUpdateTime, updateTimeStart);
		wrapper.le(updateTimeEnd!=null, RobotAidataRecording::getUpdateTime, updateTimeEnd);
	    wrapper.eq(StringUtils.isNotBlank(updateUser), RobotAidataRecording::getUpdateUser, updateUser);
	    wrapper.eq(RobotAidataRecording::getTenantId, KefuContext.getKefuContext().getTenantId());
	    
    	return wrapper;
	}
}